package com.trg.designmodel.composite;

/**
 * @ClassName: OrganizationComponent
 * @Description:    Component为所有对象定义一个类，不管是节点还是叶子类
 * @Author: tangrg
 * @Date: 2021/7/7 11:28
 * @Version: 1.0
 * @Return:
 **/
public abstract class OrganizationComponent {

    public OrganizationComponent(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    /**
     * 名称，学校的名称或者学院的名称
     */
    private String name;

    /**
     * 对学院或者学校进行描述
     */
    private String desc;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    //此类还有两种增加和删除的方法
    public void add(OrganizationComponent organizationComponent){
        throw new UnsupportedOperationException();
    }

    public void remove(OrganizationComponent organizationComponent){
        throw new UnsupportedOperationException();
    }

    //打印的方法，每个子类打印的不同，子类需要重写，写成抽象的
    protected abstract void print();

}
